export default {
    namespaced: true,
    state: {
        isShowToast: false,
        title: "我是vuex提示内容",
        type: "warning"
    },
    mutations: {
        changeIsShowToast(state, payload) {
            state.isShowToast = payload.isShow
            if (payload.isShow) {
                state.title = payload.title
                state.type = payload.type
            }
        }
    },
    actions: {
        asyncShowToast(context, payload) {
            context.commit("changeIsShowToast", payload)
            setTimeout(() => {
                context.commit("changeIsShowToast", {
                    isShow: false,
                });
            }, 3000);
        }
    }
}